/**
 * Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 *
 * For the applicable distribution terms see the license.txt -file, included in
 * the distribution.
 */

#include <QApplication>
#include "purchasableitemnonprotected.h"

#define QMLICONRESOURCE "/qml/inapppurchase/content/icons/http.png"
#define QMLICONRESOURCE_BUY "/qml/inapppurchase/content/icons/buy.png"
#define QMLICONRESOURCE_NOTREADY "/qml/inapppurchase/content/icons/notready.png"

PurchasableItemNonProtected::PurchasableItemNonProtected(DeclarativePurchaseListModel& model,
                                                         QString& productID,
                                                         QString& url):
    PurchasableItemBase(model, productID, url)
{
    m_productMetadata.drmProtection = IAPClient::OtherDrm;

    m_buy_icon = new QImage(QApplication::applicationDirPath() + QMLICONRESOURCE_BUY);
    m_notready_icon = new QImage(QApplication::applicationDirPath() + QMLICONRESOURCE_NOTREADY);
}

void PurchasableItemNonProtected::setUnlocked(QString* purchaseTicket)
{
    saveTicket(purchaseTicket);
    m_unlocked_icon = new QImage(QApplication::applicationDirPath() + QMLICONRESOURCE);
}

bool PurchasableItemNonProtected::isPurchased()
{
    return readTicket();
}
